import Vue from 'vue'
import VueRouter from 'vue-router'
Vue.use(VueRouter)
let shopId = window.location.pathname.split('/')[1]
const prefix = '/' + shopId
let defaultRoutes = [
  {
    path: prefix + '/login',
    name: 'login',
    component: resolve => {
      require(['src/views/login/index'], resolve)
    },
    meta: {
      title: '登录'
    },
    hidden: true
  },
  {
    path: prefix + '/',
    name: 'home',
    component: () => import('src/views/home/index'),
    meta: {
      title: '主页'
    },
    hidden: true
  },
  {
    path: prefix,
    component: () => import('src/views/home/index.vue'),
    icon: 'el-icon-self-shouye',
    hidden: true,
    meta: {
      title: '公共权限',
      name: 'index'
    },
    children: [
      {
        path: prefix + '/new-change-password',
        name: 'changePassword',
        component: resolve => {
          require(['src/views/login/changePass'], resolve)
        },
        meta: {
          title: '修改密码'
        },
        hidden: true
      }
    ]
  }
]
export default new VueRouter({
  mode: 'history',
  routes: defaultRoutes
})
